package com.atguigu.dao.impl;

import com.atguigu.dao.BeanDao;
import com.atguigu.dao.OrderItemDao;
import com.atguigu.pojo.OrderItem;

/**
 * @Author luoyin
 * @Date 14:00 2022/7/23
 **/
public class OrderItemDaoImpl extends BeanDao<OrderItem> implements OrderItemDao {
    @Override
    public void add(OrderItem orderItem) throws Exception {
        update(
                "insert into t_order_item values(null,?,?,?,?,?,?)",
                orderItem.getBookName(),
                orderItem.getPrice(),
                orderItem.getImgPath(),
                orderItem.getItemCount(),
                orderItem.getItemAmount(),
                orderItem.getOrderId()
        );
    }

    @Override
    public void addBatch(Object[][] orderItemParamsArr) throws Exception {
        batch(
                "insert into t_order_item values(null,?,?,?,?,?,?)",
                orderItemParamsArr
        );
    }
}
